<?php
namespace app\admin\model;
use think\Model;
class Admin extends Model{
	protected $pk = 'a_id';
	public function user(){
		
	$model = new Admin();
	
	$use = input('param.a_name');
	$pwd = input('param.a_pwd');
			
	$list = $model::where('a_name',$use)->where('a_pwd',$pwd)->find();
	
	return $list;
	
	}
	public function use1()
    {
        return $this->hasOne('use1','u_id','a_type');
    }
    public function add(){
		
		$data=input('post.');
		
		$adm = new Admin();
		
		$result = $adm->save($data);
		return $result;
	}
	public function upd(){
		
		$adm = new Admin();
		$result = $adm->save([
		  'a_name'=>input("param.a_name"),
		   'a_pwd'=>input("param.a_pwd"),
		   'a_type'=>input('param.a_type'),
		   'a_tel'=>input('param.a_tel')
		],['a_id'=>input('param.a_id')]);
		
		return $result;
	}
	
}
?>